﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Interfaces;
using DAOBase;
using System.Web.Security;

namespace Interview_Prov
{
    public partial class Login : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lf_submit_Click(object sender, EventArgs e)
        {
            Validate();
            if (IsValid)
            {
                Business.BusinessLogic bll = new Business.BusinessLogic();
                Entities.User auth_user = new Entities.User(lf_login.Text, lf_password.Text, new List<string>());
                if (bll.IsValidAuth(auth_user))
                {
                    FormsAuthentication.RedirectFromLoginPage(lf_login.Text, false);
                }
                else
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
            }
        }
    }
}